<script>
	export default {
		onLaunch: function(e) {
			/* console.log("获取司机扫码的项目id") */
			if(typeof e.query.q != 'undefined' && e.query.q != '' && e.query.q != null){
				let queryString = decodeURIComponent(e.query.q)
				let params = {}
				if (queryString) {
				  let queryArray = queryString.split('?')
				  if (queryArray.length > 1) {
					let query = queryArray[1]
					let array = query.split('&')
					array.map((value) => {
					  let valueArray = value.split('=') 
					  if (valueArray.length > 1) {
						// 还需要对value进行解码（可能涉及到在value为中文字符，在赋值到二维码前进行encodeURI编码）
						Object.assign(params, { [valueArray[0]]: decodeURI(valueArray[1]) })
					  }
					})
				  }
				}
				if(typeof params.operateId != 'undefined' && params.operateId != '' && params.operateId != null){
					uni.setStorageSync('operateId', params.operateId);
				}
			}
			
			if(typeof e.query.q != 'undefined' && e.query.q != '' && e.query.q != null){
				let queryString1 = decodeURIComponent(e.query.q)
				let params1 = {}
				if (queryString1) {
				  let queryArray1 = queryString1.split('?')
				  if (queryArray1.length > 1) {
					let query = queryArray1[1]
					let array = query.split('&')
					array.map((value) => {
					  let valueArray = value.split('=') 
					  if (valueArray.length > 1) {
						// 还需要对value进行解码（可能涉及到在value为中文字符，在赋值到二维码前进行encodeURI编码）
						Object.assign(params1, { [valueArray[0]]: decodeURI(valueArray[1]) })
					  }
					})
				  }
				}
				if(typeof params1.warehouseId != 'undefined' && params1.warehouseId != '' && params1.warehouseId != null){
					uni.setStorageSync('warehouseId', params1.warehouseId);
				}
			}
			/* console.log("自动登录") */
			try {
			    const token = uni.getStorage('token');
			    if (typeof token =='undefined'|| token == null || token == '') {
					this.$Router.replaceAll({
						name: 'login',
					})
			    }else{
					this.$Router.pushTab({
						name: 'index',
					})
				}
			} catch (e) {
			   this.$Router.replaceAll({
					name: 'login',
			   })
			}
		},
		onShow: function() {
			/* console.log('App show') */
		},
		onHide: function() {
			/* console.log('App Hide') */
		},
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	u-card-wrap { 
		background-color: $u-bg-color;
		padding: 1px;
	}
	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}
		
	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
	.wrap {
			padding: 2rpx;
		}
	.u-row {
		margin: 2rpx 0;
	}
	.foot-butten{
		color: #6c6c6c;
		font-weight: 600;
	}
	.close-btn {
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.weikaishi{
		color: #000000;
		font-weight: 600;
	}
	.weikaishi2{
		font-size: 34rpx;
		color: #000000;
		font-weight: 600;
	}
	.weikaishi3{
		font-size: 30rpx;
		color: #000000;
		font-weight: 600;
	}
	.weikaishi4{
		font-size: 28rpx;
		color: #000000;
		font-weight: 600;
	}
	.weikaishi5{
		color: #19be6b;
		font-size: 26rpx;
	}
	.weikaishi6{
		font-size: 26rpx;
	}
	.weikaishi7{
		font-size: 24rpx;
	}
	.weikaishi8{
		font-size: 22rpx;
	}
	.jinxingzhong{
		color: #ffaa00;
		font-weight: 600;
	}
	.yiwancheng{
		color: #00c300;
		font-weight: 600;
	}
	.yizuofei{
		color: #e84d74;
		font-weight: 600;
	}
	.title{
		font-size: 34rpx;
		font-weight: 600;
	}
	.lanse{
		color: #2b85e4;
	}
	.m-top{
		margin-top: 20rpx;
	}
</style>